home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 3 #11 / Commodore_Disk_User_Vol.3_11_1990_-.d64 / price calculator (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  10KB  |  272 lines

  1. 100 rem save"@0:rpi22",8
  2. 105 :
  3. 110 rem disk p14a/p14b/bu11b
  4. 115 dim p(100):rem dimension array
  5. 120 :
  6. 125 poke 53281,11:poke53280,15:poke646,15:rem set screen colours
  7. 130 :
  8. 135 rem opening menu
  9. 140 print"[147]":print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
  10. 145 [153]" (NULL)    ***** price calculator *****    (NULL)
  11. 150 print" [171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][179]
  12. 155 [153]" (NULL) (c) copyright ian l dalziel 1989   (NULL)
  13. 160 print" [221]                                    [221]
  14. 165 [153]" (NULL)         7 walker avenue            (NULL)
  15. 170 print" [221]                                    [221]
  16. 175 [153]" (NULL)    troon, ayrshire, ka10 6sa       (NULL)
  17. 180 print" [221]                                    [221]
  18. 185 [153]" -tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan<
  19. 190 print" [221]                                    [221]
  20. 195 [153]" (NULL)   press ilist for instructions         (NULL)
  21. 200 print" [221]                                    [221]
  22. 205 [153]" (NULL)   press ulist to update the index      (NULL)
  23. 210 print" [221]                                    [221]
  24. 215 [153]" (NULL)   press tlist for technical explantion (NULL)
  25. 220 print" [221]                                    [221]
  26. 225 [153]" (NULL)   press spacelist for the program      (NULL)
  27. 230 print" [221]                                    [221]
  28. 235 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
  29. 240 :
  30. 245 rem branching routine
  31. 250 get z$:if z$=""then 250
  32. 255 if z$="i"then gosub 1010:goto140
  33. 260 if z$="u"then gosub 900:goto140
  34. 265 if z$="t"then gosub 715:goto140
  35. 270 if z$<>" "then 250
  36. 275 rem the main program proceeds with space key
  37. 280 :
  38. 285 rem reads data till end of file marker -1 is read
  39. 290 d=d+1:if d<>1 then 325:rem ensures data is loaded only once
  40. 295 print"[147]":print" loading data please wait 5 seconds....":print
  41. 300 x=0:rem reset x
  42. 305 rem loop to read data and give changing number on screen
  43. 310 read p(x):print x"[145]":if p(x)=-1 then 330
  44. 315 x=x+1:goto 310
  45. 320 :
  46. 325 rem calculation menu
  47. 330 print"[147]"
  48. 335 print" [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
  49. 340 [153]" (NULL)    ***** price calculator *****    (NULL)
  50. 345 print" [221]                                    [221]
  51. 350 :
  52. 355 [143] x-1 is the last year which the rpi index is available from data
  53. 360 [153]" (NULL) applicable to the period 1900";[171](1900[170]x[171]1)"(NULL)"
  54. 365 [153]" -tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan<"
  55. 370 [153]" (NULL) press mlist for main menu    elist to exit (NULL)"
  56. 375 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
  57. 380 print:kc$="":input" known cost of item in \....";kc$
  58. 385 if kc$="m" then 140:rem exits to main menu
  59. 390 if kc$="e" then print"[147]":end
  60. 395 :
  61. 400 rem rejects wrong input
  62. 405 kc=val(kc$):if kc=0 then print"[145]"tab(30)"         [145]":goto380:
  63. 410 :
  64. 415 print:print" year of known cost...........19??[157][157]";
  65. 420 :
  66. 425 rem gets first digit of year
  67. 430 get k$:ifk$=""then 430
  68. 435 n=asc(k$):if n<48 or n>57 then 430:rem accepts only numbers
  69. 440 n$=k$:printk$;:rem first digit replaces ? on screen
  70. 445 rem gets sec0nd digit of year
  71. 450 get k$:ifk$=""then 450
  72. 455 :
  73. 460 m=asc(k$):if m<48 or m>57 then 450:rem accepts only  numbers
  74. 465 m$=k$:printk$:rem second digit replaces ? on screen
  75. 470 :
  76. 475 yn=val(n$+m$):print:rem calculates the year of known price
  77. 480 rem rejects year whose rpi index is not known
  78. 485 if p(yn)<=0 then print" index not updated to include this year[155]":goto415
  79. 490 :
  80. 495 rem time delay to empty buffer to separate get statements
  81. 500 for i=1 to 100:next i
  82. 505 for i=1 to 10:get k$:next i
  83. 510 :
  84. 515 print" year you wish to know cost...19??[157][157]";
  85. 520 :
  86. 525 rem gets first digit of year
  87. 530 get k$:ifk$=""then 530
  88. 535 f=asc(k$):if f<48 or f>57 then 430:rem accepts only numbers
  89. 540 f$=k$:printk$;:rem first digit replaces ? on screen
  90. 545 :
  91. 550 rem gets sec0nd digit of year
  92. 555 get k$:ifk$=""then 555
  93. 560 g=asc(k$):if g<48 or g>57 then 450:rem accepts only numbers
  94. 565 g$=k$:printk$:rem second digit replaces ? on screen
  95. 570 :
  96. 575 yu=val(f$+g$):print:rem caculates year you want to know cost
  97. 580 rem rejects year whose rpi index is not known
  98. 585 if p(yu)<=0 then print" index not updated to include this year[155]":goto515
  99. 590 :
  100. 595 rem calculates desired price and rounds to 2 decimal places
  101. 600 q=kc/p(yn)*p(yu):q=int(q*100+0.5)/100:
  102. 605 if q>100 then q=int(q+0.5):rem no decimal places for price over \100
  103. 610 print:print" cost of item in"1900+yu"prices=\"q:
  104. 615 print" [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]":print
  105. 620 rem time delay to empty buffer to separate get statements
  106. 625 for i=1 to 100:next i
  107. 630 for i=1 to 10:get k$:next i
  108. 635 :
  109. 640 rem exit menu
  110. 645 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
  111. 650 [153]" (NULL) --- press space for another go --- (NULL)"
  112. 655 [153]" (NULL)                                    (NULL)"
  113. 660 [153]" (NULL)   mlist for main menu    elist to exit     (NULL)"
  114. 665 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
  115. 670 get k$:ifk$=""then670
  116. 675 if k$="e" then end
  117. 680 if k$="m" then 140
  118. 685 if k$<>" " then 670
  119. 690 goto330:rem space gives another go
  120. 695 :
  121. 700 rem data giving rpi index for 5 years starting at year of line number
  122. 705 :
  123. 710 rem subroutine for technical data info
  124. 715 print"[147]":print" how the rpi index was calculated
  125. 720 [153]" --------------------------------
  126. 725 print" the data statements give the retail
  127. 730 [153]" price index for july of each year
  128. 735 print" from 1900 to 1990 (based on jan 87=100)"
  129. 740 print" each line of data gives rpi for 5 years
  130. 745 [153]"on starting with the year of line number":[153]
  131. 750 [153]" i have estimated the july 1990 index
  132. 755 print" as +7% of july 1989 index
  133. 760 [153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]
  134. 765 [153]" ------ space for one more page -------"
  135. 770 [161]k$:[139] k$[178]""[167] 770
  136. 775 :
  137. 780 [143] second page of technical info
  138. 785 [153]"load":[153]" prior to 1987 the index was calculated
  139. 790 print" from the indexes published at the time
  140. 795 [153]" as follows.......":[153]
  141. 800 [153]" from 1974-1986 the index published was
  142. 805 print" jan 74=100. this is divided by 3.945
  143. 810 [153]" (because the jan 87 index based on
  144. 815 print" jan 74=100 was 394.5)
  145. 820 [153]
  146. 825 [153]" from 1962-1973 the index published was
  147. 830 print" jan 62=100. this is divided by
  148. 835 [153]" 3.945*1.918 (because the jan74 index
  149. 840 print" based on jan 62=100 was 191.8)":print
  150. 845 print" from 1900-1961 i calculated the index
  151. 850 [153]" from the book:-britain in figures
  152. 855 print" by alan sillitoe (pelican 1973) p151":print
  153. 860 print" anyone is welcome to check the
  154. 865 [153]" calculations and let me know if you
  155. 870 print" find any major errors":print
  156. 875 print" --------- space for the menu ---------"
  157. 880 getk$:if k$=""then 880
  158. 885 return
  159. 890 :
  160. 895 rem subroutine about updating the index called from main menu
  161. 900 print"[147]":print" how the update the index
  162. 905 [153]" --------------------------------
  163. 910 print" the index for july 1990 is only an
  164. 915 [153]" estimate, so it should be corrected
  165. 920 print" once the actual index becomes known
  166. 925 [153]" in august 1990.  replace the first
  167. 930 print" piece of data on line 1990 (123.6)"
  168. 935 print" with the correct index":print
  169. 940 print" in order to use the program after 1990
  170. 945 [153]" you will need to estimate the rpi for
  171. 950 print" july of the year in question by adding
  172. 955 [153]" the estimated inflation rate to the
  173. 960 print" previous year's index and replace -1
  174. 965 [153]" in the data statement with the index":[153]
  175. 970 [153]" you may continue the process each year
  176. 975 print" by making an estmate of the july index
  177. 980 [153]" in january and correcting it in august":[153]:[153]
  178. 985 [153]" --------- space for the menu ---------"
  179. 990 [161]k$:[139] k$[178]""[167] 990
  180. 995 [142]
  181. 1000 :
  182. 1005 [143] subroutine with 4 pages of worked examples called from main menu
  183. 1010 [153]"load":[153]" how to use the program
  184. 1015 print" --------------------------------
  185. 1020 [153]" example 1......":[153]
  186. 1025 [153]" say you want to know how much your
  187. 1030 print" pocket money in 1960 of 2/6p old money
  188. 1035 [153]" (12.5p in decimal money) would buy at
  189. 1040 print" todays prices":print
  190. 1045 print" for known price...enter 0.125":print
  191. 1050 print" for year of known price...enter 60":print
  192. 1055 print" for year you wish to know the price...
  193. 1060 [153]" enter 89":[153]
  194. 1065 [153]" the answer is \1.1":[153]:[153]:[153]:[153]
  195. 1070 [153]" ----- space for 3 more examples -----
  196. 1075 getk$:if k$=""then 1075
  197. 1080 :
  198. 1085 print"[147]":print" example 2........":print
  199. 1090 print" say you are treasurer of a bridge club
  200. 1095 [153]" which has been charging 40p a night
  201. 1100 print" since 1980.  you are proposing
  202. 1105 [153]" an increase to 60p and want to see how
  203. 1110 print" that compares with the original charge
  204. 1115 [153]" at today's prices..":[153]
  205. 1120 [153]" for known price....enter 0.40":[153]
  206. 1125 [153]" for year of known price....enter 80":[153]
  207. 1130 [153]" for year you wish to know the price..
  208. 1135 print" enter 89":print
  209. 1140 print" the answer is 68p.  so your proposed
  210. 1145 [153]" increase is less than would be needed
  211. 1150 print" to keep up with inflation
  212. 1155 [153]:[153]
  213. 1160 [153]" ----- space for 2 more examples ------"
  214. 1165 [161]k$:[139] k$[178]""[167] 1165
  215. 1170 :
  216. 1175 [153]"load":[153]" example 3........":[153]
  217. 1180 [153]" your son has just left school and
  218. 1185 print" started work in an office at a salary
  219. 1190 [153]" of \7000 per annum.  you wonder how
  220. 1195 print" that compares with your first salary
  221. 1200 [153]" of \350 per annum when you started
  222. 1205 print" work in 1965.":print
  223. 1210 print" for known price...enter 7000":print
  224. 1215 print" for year of known price...enter 89":print
  225. 1220 print" for year you wish to know the price...
  226. 1225 [153]" enter 65.":[153]
  227. 1230 [153]" the answer is \899.  so you son makes
  228. 1235 print" two and a half times your first
  229. 1240 [153]" salary in real terms!":[153]:[153]
  230. 1245 [153]" ------ space for 1 more example ------"
  231. 1250 [161]k$:[139] k$[178]""[167] 1250
  232. 1255 [153]"load":[153]" example 4........":[153]
  233. 1260 :
  234. 1265 [153]" you pay your gardener \2.30 per hour
  235. 1270 print" and have done so since 1985. you want
  236. 1275 [153]" to know how much you should
  237. 1280 print" increase his salary to keep its value
  238. 1285 [153]" at today's prices.":[153]
  239. 1290 [153]" for known price...enter 2.30":[153]
  240. 1295 [153]" for year of known price...enter 85":[153]
  241. 1300 [153]" for year you wish to know the price...
  242. 1305 print" enter 89.":print
  243. 1310 print" the answer is \2.79  so you should
  244. 1315 [153]" increase his wages to at least that!":[153]:[153]:[153]:[153]
  245. 1320 [153]" ------------ space for menu ----------"
  246. 1325 [161]k$:[139] k$[178]""[167] 1325
  247. 1330 [142]
  248. 1335 :
  249. 1340 [143] data statements holding rpi indexes
  250. 1345 [143] each line gives rpi for 5 years starting with year of line number
  251. 1900 [131] 2.564,2.583,2.601,2.620,2.638
  252. 1905 [131]   2.6569, 2.69212, 2.72734 ,2.76256 ,2.797786
  253. 1910 [131] 2.833, 2.9886 ,3.1442 ,3.2998, 3.4554
  254. 1915 [131] 3.611, 4.3538, 5.0966, 5.8394 ,6.5822
  255. 1920 [131]     7.325, 6.8959, 6.4668, 6.0377 ,5.6086
  256. 1925 [131]    5.1795, 5.0759, 4.9723 ,4.8687 ,4.7651
  257. 1930 [131] 4.6615 ,4.56982, 4.47814 ,4.38646 ,4.29478
  258. 1935 [131]         4.2031 ,4.51488, 4.82666, 5.13844, 5.45022
  259. 1940 [131]      5.7615 ,6.11736, 6.47322, 6.82908 ,7.18494
  260. 1945 [131] 7.5408 ,7.931802, 8.322804 ,8.713806 ,9.104808
  261. 1950 [131]    9.49581001, 9.927448 ,10.359086, 10.790724, 11.222362
  262. 1955 [131]  11.654 ,11.95282, 12.25164, 12.55046 ,12.84928
  263. 1960 [131]13.1481, 13.48418 ,13.82026 ,14.15634 ,14.49242
  264. 1965 [131] 14.8285,15.21180,15.62150,16.52010,17.4188
  265. 1970 [131] 18.6083,20.51140,21.7009,23.7494,27.8068
  266. 1975 [131] 35.1077,39.6198,46.59060,50.2155,58.0735
  267. 1980 [131] 67.9087,75.3105,81.8758,85.2978,89.1001
  268. 1985 [131] 95.2344,97.7946,101.8,106.7,115.5
  269. 1990 [131] 123.6,-1,-1,-1,-1,-1
  270. 1995 [131] -1,-1,-1,-1,-1
  271. 2000 [131] -1
  272.